<?php

namespace App\Http\Controllers;

use App\Http\Service\QuestionsService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class QuestionsDetailJGController extends  Controller{

    public function index(Request $request){

    }

    /*
     * @author wangan
     * @since 20170510
     * @desc 添加一条上午卷子题目
     * */
    public function create(Request $request)
    {
        $int_pid = $request->pid;

        if (!$int_pid) {
            return redirect()->back()->withErrors('pid 出错请联系管理员！');
        }
        $arr_type = QuestionsService::getTypes();
        return view('questionsJg.create', [
            'types' => $arr_type,
        ]);
    }

    public function doCreate(Request $request){
        $arr_info = $request->info;
        $arr_imgs = $request->imgs;
        $arr_imgs =array_filter($arr_imgs);

        dd($arr_imgs);

    }

    private function __validate(Request $request){
        return $this->validate($request,[
            'info.title'=>'required',
            /*'show-time-temp'=>'required',
            'info.type'=>'required|integer',
            'info.source'=>'required|integer',
            'info.sort'=>'required|integer',*/
        ],[
            'required'=>':attribute不能为空',
            'integer'=>':attrbute必须为整数'
        ],[
            'info.title'=>'名称',
            /*'info.type'=>'公告类型',
            'info.source'=>'公告来源',
            'info.sort'=>'排序',
            'show-time-temp'=>'发布时间',*/
        ]);
    }

}